#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>

// Add this function to your code
std::ostream& operator<<(std::ostream& os, const std::vector<std::string>& vec) {
    os << '(';
    for (size_t i = 0; i < vec.size(); ++i) {
        os << vec[i];
        if (i + 1 < vec.size()) {
            os << ", ";
        }
    }
    os << ')';
    return os;
}

class CSVParser {
public: {   if (!file.is_open()) {
            throw std::runtime_error("NULL" + filePath);
        }
    }

    std::vector<std::string> getNextLine() {
        if (file.eof()) {
            return {};
        }

        std::vector<std::string> result;
        std::string line;
        std::getline(file, line);

        std::stringstream lineStream(line);
        std::string cell;

        while (std::getline(lineStream, cell, ',')) {
            result.push_back(cell);
        }

        return result;
    }

private:
    std::ifstream file;
};

int main() {
    CSVParser parser1("D:\\original_data.csv");
    CSVParser parser2("D:\\data_for_check.csv");

    while (true) {
        auto line1 = parser1.getNextLine();
        auto line2 = parser2.getNextLine();

        if (line1.empty() || line2.empty()) {
            break;
        }

        if (line1 != line2) {
            std::cout << "Lines differ: " << line1 << " and " << line2 << std::endl;
        }
    }

    return 0;
}


